//  https://ac.nowcoder.com/acm/problem/53675

#include<iostream>
using namespace std;

int n, m;
const int N = 3010;
int a[N][N];
int dp[N][N];

int main()
{
    scanf("%d%d", &m, &n);
    for (int i = 1;i <= m;i++)
    {
        for (int j = 1;j <= n;j++)
            scanf("%d", &a[i][j]);
    }

    dp[n][0] = 1;
    for (int i = m + 1;i > 0;i--)
    {
        for (int j = 1;j <= n;j++)
        {
            if (a[i][j] == 0)
                dp[i][j] = (dp[i + 1][j] + dp[i][j - 1]) % 2333;
        }
    }
    cout << dp[1][m] << endl;
    return 0;
}